/**
 * Copyright &copy; 2012-2016 <a href="https://istep.lczyfz.com">Istep</a> All rights reserved.
 */
package com.lczyfz.istep.modules.scene.service;

import com.lczyfz.istep.common.persistence.Page;
import com.lczyfz.istep.common.service.CrudService;
import com.lczyfz.istep.modules.scene.dao.SceneVmTypeDao;
import com.lczyfz.istep.modules.scene.entity.SceneVmType;
import com.lczyfz.istep.modules.sys.entity.User;
import com.lczyfz.istep.modules.sys.utils.UserUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * 云主机类型管理Service
 * @author dg
 * @version 2017-04-07
 */
@Service
@Transactional(readOnly = true)
public class SceneVmTypeService extends CrudService<SceneVmTypeDao, SceneVmType> {

	public SceneVmType get(String id) {
		return super.get(id);
	}
	
	public List<SceneVmType> findList(SceneVmType sceneVmType) {
		return super.findList(sceneVmType);
	}
	
	public Page<SceneVmType> findPage(Page<SceneVmType> page, SceneVmType sceneVmType) {
		return super.findPage(page, sceneVmType);
	}
	
	@Transactional(readOnly = false)
	public void save(SceneVmType sceneVmType) {
		super.save(sceneVmType);
	}
	
	@Transactional(readOnly = false)
	public void delete(SceneVmType sceneVmType) {
		super.delete(sceneVmType);
	}

	@Transactional(readOnly = false)
	public void insert(SceneVmType sceneVmType) {
		dao.insert(sceneVmType);
	}
	public void preInsert(SceneVmType preInfo) {

		User user = UserUtils.getUser();
		if (StringUtils.isNotBlank(user.getId())) {
			preInfo.setUpdateBy(user);
			preInfo.setCreateBy(user);
		}
		Date date=new Date();
		preInfo.setUpdateDate(date);
		preInfo.setCreateDate(date);

	}
	
}